<?php
include_once("./php/get_sp.php");
include_once("./php/get_sp_view.php");

$sp = dejson($sp);
$sp_view = dejson($sp_view);
if($sp->error || $sp_view->error){
	exit;
}

$title = '专题页';
$url = '/wechat-bangumi/spContent.php?spid='.$_GET['spid'];
include_once($_SERVER["DOCUMENT_ROOT"]."/common/header.php");
?>

<body>

<section data-role="page" id="sp">
	
	<div data-role="header" data-position="fixed" data-add-back-btn="true" data-back-btn-text="返回" data-theme="b" data-type="horizontal">
		<h1>&nbsp;</h1>
	</div>
	
	
	<div data-role="content">
		<div id="title" class="ui-grid-a">
			<div class="ui-block-a spContent" id="spImage"><img src="<?php echo $sp->content->cover; ?>"></img></div>
			<div class="ui-block-b spContent" id="spTitle">
			<?php
				$title = explode(',', $sp->content->alias);
				echo '<p>'.$sp->content->title.'</p>';
				for($i=0; $i<count($title) ;$i++){
					if($title[$i]){
						echo '<p>'.$title[$i].'</p>';
					}
				}
			?>
			</div>
		</div>
		<div id="spDescription" class="ui-grid-b spContent">
			<?php echo $sp->content->description; ?>
		</div>
		<div id="spLastupdate" class="ui-grid-a spContent">
			最后更新： <?php echo date("Y-m-d H:i", $sp->content->lastupdate); ?>
		</div>
		<div class="ui-grid-b">
			<div class="ui-block-a spContent spCount" id="spView"><p>点击量</p><p><?php echo $sp->content->view; ?></p></div>
			<div class="ui-block-b spContent spCount" id="spFavourite"><p>收藏量</p><p><?php echo $sp->content->favourite; ?></p></div>
			<div class="ui-block-c spContent spCount" id="spCount"><p>视频数</p><p><?php echo $sp->content->count; ?></p></div>
		</div>
		<div class="ui-grid-a spContent">
			<ul id="spViewList" data-role="listview">
				<?php
					foreach($sp_view->list as $row){
						echo '<li data-icon="false"><a href="#aid'.$row->aid.'" data-rel="popup" data-transition="pop">'.mb_substr($row->title, 0, 19, 'UTF-8').'<span class="ui-li-count">'.$row->click.'</span></a></li>';
						echo '<div data-role="popup" id="aid'.$row->aid.'"><p>'.$row->title.'</p></div>';
					}
				?>
			</ul>
		</div>
	</div>
	
	<div data-role="footer" data-position="fixed" data-theme="b" data-type="horizontal">
		<h2>新番助手@wit-helper</h2>
	</div>
</section>

</body>
</html>